#ifndef __APP_OTA_H__
#define __APP_OTA_H__

#ifdef __cplusplus
extern "C" {
#endif

#define APP_OTA_MAX_URL_LEN (128)

/**
 * @brief OTA configuration
 */
typedef struct
{
    char url[APP_OTA_MAX_URL_LEN];          // OTA URL
} app_ota_config_t;

/**
 * @brief OTA server configuration
 */
typedef struct
{
    char url[APP_OTA_MAX_URL_LEN];          // OTA 服务器 URL
} app_ota_server_config_t;

/**
 * @brief Initialize OTA
 * 
 * @param cfg OTA configuration
 * @return 0 on success, -1 on failure
 */
int app_ota_init(app_ota_config_t *cfg);

/**
 * @brief Deinitialize OTA
 * 
 * @return 0 on success, -1 on failure
 */
int app_ota_deinit(void);

/**
 * @brief Get OTA configuration
 * 
 * @return OTA configuration
 */
app_ota_config_t *app_ota_get_cfg(void);

/**
 * @brief Get OTA server configuration
 * 
 * @return OTA server configuration
 */
app_ota_server_config_t *app_ota_get_server_cfg(void);

#ifdef __cplusplus
}
#endif

#endif
